package com.hspedu.homework.homework2;

import org.junit.Test;

import java.util.Arrays;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/4/18
 * @time 18:32
 */
public class Homework02 {
    public static void main(String[] args) {
        String regex = "[-+]?([1-9]\\d*|0)(\\.\\d+)?";
        String num = "-1.89";
        System.out.println(num.matches(regex));
    }

    @Test
    public void test1(){
        int[] nums = {13,43,11,4,9,100};
        for (int i = 1; i <= nums.length - 1 ; i++) {
            for (int j = 1; j <= nums.length - i ; j++) {
                int temp;
                if (nums[j-1] > nums[j]){
                    temp = nums[j];
                    nums[j] = nums[j+1];
                    nums[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(nums));
    }
}
